#coding=utf-8
from appengine_django.models import BaseModel
from google.appengine.ext import db

# Create your models here.
 
class Comic(BaseModel):
    owner = db.UserProperty()
    name = db.StringProperty(required=True, verbose_name=u'漫画名称')
    alias = db.StringProperty(verbose_name=u'漫画别名')
    author = db.StringProperty(verbose_name=u'漫画作者')
    version = db.StringProperty(verbose_name=u'扫描版本')
    memo = db.TextProperty(verbose_name=u'漫画描述')
    position = db.StringProperty(verbose_name=u'保存位置')
    latest_episod = db.StringProperty(verbose_name=u'最新话数')
    is_finished = db.BooleanProperty(verbose_name=u'已完结')
    create_time = db.DateTimeProperty(auto_now_add=True)
    update_time = db.DateTimeProperty(auto_now=True)
    
    def get_absolute_url(self):
        return '/comic/%s/'%self.key().id()

from google.appengine.ext.db import djangoforms as forms

class ComicForm(forms.ModelForm):
    class Meta:
        model = Comic
        exclude = ['owner']
